package com.cgt.web.service.impl;

import com.cgt.web.dao.ITea1Dao;
import com.cgt.web.dao.impl.Tea1DaoImpl;
import com.cgt.web.pojo.Teacher;
import com.cgt.web.pojo.query.Teacher1Query;
import com.cgt.web.service.ITea1Service;
import com.cgt.web.util.PageResult;

import java.util.List;

public class Tea1ServiceImpl implements ITea1Service {
	private ITea1Dao tea1Dao = new Tea1DaoImpl();
	@Override
	public void deleteAll(String[] ids) {
		for (String id : ids) {
			tea1Dao.deleteById(Integer.parseInt(id));
		}
	}

	@Override
	public void update(Teacher teacher) {
		tea1Dao.update(teacher);
	}

	@Override
	public Teacher selectById(int id) {
		return tea1Dao.selectById(id);
	}

	@Override
	public void add(Teacher teacher) {
		tea1Dao.add(teacher);
	}

	@Override
	public void deleteById(int id) {
		tea1Dao.deleteById(id);
	}

	@Override
	public PageResult<Teacher> selectByPage(Teacher1Query teacher1Query) {
		List<Teacher> list = tea1Dao.selectByPage(teacher1Query);
		Integer totalCount = tea1Dao.selectTotalCount(teacher1Query);
		PageResult<Teacher> pageResult =  new PageResult<>(0, "", totalCount, list);
		return pageResult;
	}
}
